/**
 * Copyright 2018-2019 jianggujin (www.jianggujin.com).
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jianggujin.modulelink.util;

import com.jianggujin.logging.JLogFactory;
import com.jianggujin.modulelink.util.JLogFactory.JLog;

/**
 * JLogging适配器
 * 
 * @author jianggujin
 *
 */
public class JLoggingAdapter implements JLog {
    private com.jianggujin.logging.JLog logger;

    public JLoggingAdapter(String clazz) {
        logger = JLogFactory.getLog(clazz);
    }

    @Override
    public boolean isErrorEnabled() {
        return logger.isErrorEnabled();
    }

    @Override
    public boolean isInfoEnabled() {
        return logger.isInfoEnabled();
    }

    @Override
    public boolean isWarnEnabled() {
        return logger.isWarnEnabled();
    }

    @Override
    public boolean isDebugEnabled() {
        return logger.isDebugEnabled();
    }

    @Override
    public boolean isTraceEnabled() {
        return logger.isTraceEnabled();
    }

    @Override
    public void error(String msg, Object... args) {
        logger.error(JStringUtils.format(msg, args));
    }

    @Override
    public void error(String msg, Throwable e) {
        logger.error(msg, e);
    }

    @Override
    public void debug(String msg, Object... args) {
        logger.debug(JStringUtils.format(msg, args));
    }

    @Override
    public void debug(String msg, Throwable e) {
        logger.debug(msg, e);
    }

    @Override
    public void trace(String msg, Object... args) {
        logger.trace(JStringUtils.format(msg, args));
    }

    @Override
    public void trace(String msg, Throwable e) {
        logger.trace(msg, e);
    }

    @Override
    public void warn(String msg, Object... args) {
        logger.warn(JStringUtils.format(msg, args));
    }

    @Override
    public void warn(String msg, Throwable e) {
        logger.warn(msg, e);
    }

    @Override
    public void info(String msg, Object... args) {
        logger.info(JStringUtils.format(msg, args));
    }

    @Override
    public void info(String s, Throwable e) {
        logger.info(s, e);
    }

}
